package com.bstek.urule.accident;

import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

public class ClientUtil {

	public static void main(String[] args) {
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
		String jsonData = "{\r\n" + 
				"        \"name\": \"客户\",\r\n" + 
				"        \"fields\": {\r\n" + 
				"            \"lowDensityLipoprotein\": \"3\",\r\n" + 
				"            \"diastolic\": \"70\",\r\n" + 
				"            \"systolic\": \"100\",\r\n" + 
				"            \"gender\": \"true\",\r\n" + 
				"            \"name\": \"张三\",\r\n" + 
				"            \"cholesterol\": \"6\",\r\n" + 
				"            \"id\": \"001\",\r\n" + 
				"            \"age\": \"20\"\r\n" + 
				"        }\r\n" + 
				"    }";
		HttpEntity entity = new HttpEntity(jsonData, headers);
		ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8080/urule-demo/urule/rest/寿险意外险核保项目/totalResultTest", entity, String.class);
		System.out.println(response.getBody());
	}

}
